package gagak.framework.web.view;

import com.alibaba.fastjson.JSON;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;

/*
 * @program: ce
 * @description: fastJson视图解析器
 * @author: houhong
 * @create: 2022-12-02 00:54
 */
public class FastJsonViewResolver extends AbstractJsonView {



    @Override
    public String getContentType() {
        return null;
    }
    @Override
    public void render(Object resultValue, HttpServletRequest request, HttpServletResponse response) throws Exception {

        String resultStr = JSON.toJSONString(resultValue);
        PrintWriter writer = response.getWriter();
        writer.print(resultStr);
        writer.flush();
        writer.close();
    }
}